#player handling

MENU_VOID = -1
MENU_EXIT = 1
MENU_OPEN = 2
GAME_UNIT = 3
GAME_VOID = -1
GAME_LAND = 4
ACTION_VOID = -1
ACTION_BUILD = 5
ACTION_DEMOLISH = 6


class player:

    m_logger = None
    
    
    #player-game specific info
    m_currency = None
    m_units = None
    m_inputh = None
    
    m_menu_selection = None
    m_game_selection = None
    m_action = None
    m_action_selection = None
    
    def __init__(self, input_handle , log):
        self.m_logger = log
        
        self.m_inputh = input_handle
        
        self.m_currency = 0
        self.m_units = {}
        self.m_action = ACTION_VOID
        self.m_action_selection = ACTION_VOID
    
    def update(self):
        
        if self.m_inputh.m_action :
            #It seems to be more efficient if the player routine checks areas clicked instead of the input handler itself
            #NOTE this is a hack, and probably the player enviornment should register areas itself first
            #but the menu buttons are just reserved number like 0,1,2,3,4,5 untill 10?:
            if( (self.m_action_selection != ACTION_BUILD) and self.m_inputh.Area.check_select() == 0 ):
                self.m_action_selection = ACTION_BUILD
                ret = self.m_inputh.Area.check_select()
                return
            if( self.m_action_selection == ACTION_BUILD and self.m_inputh.Area.check_select() == -1 ):
                self.m_action = ACTION_BUILD
                ret = self.m_inputh.Area.check_select()
                
            
        #Huge update routine